<template>
  <el-dialog :title="title" :visible.sync="open" width="960px" append-to-body v-drag-fullscreen>
    <el-table v-loading="loading" :data="fiscalRecordList" >
      <el-table-column label="结账期间" align="center" prop="fiscalPeriod"/>
      <el-table-column label="结账类型" align="center" prop="fiscalType">
        <template slot-scope="scope">
          {{ dict.label.payment_type[scope.row.fiscalType] }}
        </template>
      </el-table-column>
      <el-table-column label="结账人" align="center" prop="createBy"/>
      <el-table-column label="结账日期" align="center" prop="createTime"/>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

  </el-dialog>
</template>

<script>

  import {listMixin} from "@/utils/mixins/listMixin";
  import {listFiscalRecord, delFiscalRecord, exportFiscalRecord} from "@/api/payfee/fiscalRecord";

  export default {
    name: "FiscalRecord",
    mixins: [listMixin],
    dicts: ['payment_type',],
    data() {
      return {
        title:'',
        open:false,
        // 结账记录表格数据
        fiscalRecordList: [],
        // 查询参数
        queryParams: {
          pageNum: 1,
          pageSize: 10,
          fiscalPeriod: null,
          fiscalType: null,
          fiscalContent: null,
        },
        currentNode:{}
      };
    },
    created() {
    },
    methods: {
      show(option){
        this.currentNode = option.currentNode
        this.title= `小区[${option.currentNode.label}]结账记录`
        this.open = true
        this.getList()
      },
      /** 查询结账记录列表 */
      getList() {
        this.loading = true;
        this.queryParams.communityId = this.currentNode.id || -1
        listFiscalRecord(this.queryParams).then(response => {
          this.fiscalRecordList = response.rows;
          this.total = response.total;
          this.loading = false;
        });
      },
      /** 搜索按钮操作 */
      handleQuery() {
        this.queryParams.pageNum = 1;
        this.getList();
      },
      /** 重置按钮操作 */
      resetQuery() {
        this.resetForm("queryForm");
        this.handleQuery();
      },
    }
  };
</script>
